// import {taskLists} from "../../../utils/data/enterPrise.js"
import {reserveList, getmy } from '../../../utils/api/module/task.js'
Page({
    data: {
        imgs:{
            unAppointmnetImg:'/assets/img/unAppointment.png'
        },
        taskLists: [],
        list:[],
    },
    onLoad: function (options) {

    },
    onShow() {
        // this.reserveList();
        this.getList();
        this.getMyInfo();
    },
    getList (){
        reserveList({
            mid: wx.getStorageSync('userInfo').mid,
        },{
            Cookie: 'SESSION_='+wx.getStorageSync('session_id'),
        }).then(res => {
            console.log('我预约的服务=====================>',res);
            //暂无数据
            if(res.data.code !=0 ){
                this.setData({ taskLists: res.data.data });
            };
        });
    },
    getMyInfo(){
        getmy({
            mid: wx.getStorageSync('userInfo').mid,
        },{
            Cookie: 'SESSION_='+wx.getStorageSync('session_id'),
        }).then(res => {
            this.setData({
                certstatus: !res.data.data ? '' : res.data.data.certstatus
            })
            // if(this.data.certstatus != 3) this.showTips();
        });
    },
    showTips: function() {
        let userData = wx.getStorageSync('userInfoData'),
            url = '/pages/enterprise/authentication/index',
            title = '需认证通过才能使用该功能',
            btnContent = '重新认证';
        if(!userData.data || !userData.data.certstatus && userData.data.certstatus != 0) {
            url = '/pages/loginAndRegister/login/index';
            title = '必须登录且认证通过才能使用该功能';
            btnContent = '去登录'
        };
        if(userData.data && userData.data.certstatus == 0) {
            url = '/pages/enterprise/authentication/index';
            title = '需认证通过才能使用该功能';
            btnContent = "去认证";
        };
        if(userData.data && userData.data.certstatus == 1) {
            url = '/pages/enterprise/authentication/index';
            title = '需认证通过才能使用该功能';
            btnContent = "去查看";
        };
        wx.showModal({
            title: '提示',
            content: title,
            cancelText: '取消',
            cancelColor: '#999999',
            confirmText: btnContent,
            confirmColor: '#3b99f5',
            success: res => {
              this.data.theRedEnvelopeSuper = false;
              if (res.confirm) {
               wx.navigateTo({
                 url: url
               })
              }
            }
        });
    },
    /**
     * 组建中删除以后的回调函数
     * @param e
     */
    successCallback(e){
        console.log('我预约的服务组件删除回调',e);
    }
});